<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<?php
@session_start();
require 'Connect_db.php';
Connect_db();
if (isset($_POST['login'])) {
    $email = $_POST['email'];
    $pass = $_POST['pass'];
    $kq1 = checkEmail($email);
    if ($kq1 == true) {
        $kq2 = checkLogin($email, $pass);
        if ($kq2 == true) {
            $rows = getCustomer($email, $pass);
            $_SESSION['cus'] = array('cus_id' => $rows['cus_id'], 'cus_name' => $rows['cus_name']);
            header("location:home.php");
            //đăng nhập thành công chuyển về trang chủ
        } else {
            $_SESSION['email'] = $email;
            $_SESSION['pass'] = $pass;
            $_SESSION['ok'] = 1;
            header("location:login-register.php");
        }
    } else {
        $_SESSION['email'] = $email;
        $_SESSION['pass'] = $pass;
        $_SESSION['ok'] = 2;
        header("location:login-register.php");
    }
}
close_Db();
?>
